define(['jquery', 'knockout','durandal/app','durandal/system'], function($, ko,app,system) {
	function getData(id) {
		var def = $.Deferred();
		var data = {
			type: 'banana',
			color: 'yellow',
			id: id
		}
		app.trigger('loading:show');
		setTimeout(function () {
			def.resolve(data);
			app.trigger('loading:hide');
		}, 1000);
		return def.promise();
	}
	debugger;
	var data = ko.observable({});
	return {
		data: data,
		activate: function(...rest) {
			debugger;
			var id = 0;
			if($.isNumeric(rest[0])) {
				id = rest[0];
			} else {
				id = 0;
			}
			return getData(id).done(d => data(d));
		}
	}
})